package org.yaac.client.widget.egql;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

/**
 * @author Max Zhu (thebbsky@gmail.com)
 *
 */
public class EGQLErrorPanel extends Composite {

	private static EGQLErrorPanelUiBinder uiBinder = GWT.create(EGQLErrorPanelUiBinder.class);

	interface EGQLErrorPanelUiBinder extends UiBinder<Widget, EGQLErrorPanel> {
	}

	@UiField
	Button closeBtn;
	
	@UiField
	DivElement errMsgTxt;
	
	public EGQLErrorPanel(String errHtml) {
		initWidget(uiBinder.createAndBindUi(this));
		
		this.errMsgTxt.setInnerHTML(errHtml);
	}

	@UiHandler("closeBtn")
	void onCloseBtnClick(ClickEvent event) {
		this.removeFromParent();
	}
}
